import {Injectable} from '@angular/core';
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

import { environment } from '../../environments/environment';
//
// const prodServer = 'http://localhost:5201/';
// const devServer = 'http://localhost:5201/';
// const userServer = environment.bootUrl;

@Injectable()
export class RootHttpInterceptor implements HttpInterceptor {
  intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    // console.log(this);
    const serverReq = req.clone({url: environment.bootUrl + req.url});
    return next.handle(serverReq);
  }
}
